from django.db import models

class Users(models.Model):
    ## 属性  --字段  设置字段数据类型 字符型models.CharField
    ## 数值型models.DecimalField() 时间型models.DateTimeField()
    uid = models.AutoField(primary_key=True)
    username = models.CharField(max_length=32)
    userpsd = models.CharField(max_length=32)
class Goods(models.Model):
    # {'id': '1', 'name': '西瓜', 'imagesrc': '/static/image/001.png', 'price': '9.0', 'count': '1'},
   gid = models.AutoField(primary_key=True)
   name = models.CharField(max_length=32)
   imgsrc = models.CharField(max_length=64)
   price = models.DecimalField(max_digits=10, decimal_places=2)
   count = models.DecimalField(max_digits=10, decimal_places=0)

class Cars(models.Model):
    cid = models.AutoField(primary_key=True)
    #gid = models.DecimalField(max_digits=10,decimal_places=0)
    good = models.ForeignKey('Goods',on_delete=models.CASCADE)
    buy_count = models.DecimalField(max_digits=10,decimal_places=0)
    uid = models.DecimalField(max_digits=10, decimal_places=0)